﻿#region Using Directives

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    using Csla;

    using MarketPulse.Reporting.Core;

#endregion

namespace MarketPulse.Reporting.Core.Criteria
{
    /// <summary>
    /// Criteria class that specifies the criteria used when constructing and populating a Results object.
    /// </summary>
    [Serializable]
    public class ResultsCriteria : CriteriaBase<ResultsCriteria>
    {          

        #region Constructors

            /// <summary>
            /// Create a new instance of the ResultsCriteria class with the values specified.
            /// </summary>
            /// <param name="clientGUID">The GUID of the Client used to retrieve the list</param>                
            /// <param name="reportingLevels">The ReportingLevelInfoList object to refer to to filter the results.</param>                
            /// <param name="language">The language identifier (ie. en or fr) to use when localising text from the database.</param>                
            /// <param name="currentStartDateTime">The start date of the reporting period.</param>
            /// <param name="currentEndDateTime">The end date of the reporting period.</param>
            /// <param name="dataStartDateTime">The start date of when to retrieve data.</param>
            /// <param name="dataEndDateTime">The end date of when to retrieve data.</param>   
            public ResultsCriteria(Guid clientGUID, ReportingLevelInfoList reportingLevels, string language, DateTime currentStartDateTime, DateTime currentEndDateTime, DateTime dataStartDateTime, DateTime dataEndDateTime)
            {
                ClientGUID = clientGUID;
                ReportingLevels = reportingLevels;
                Language = language;
                CurrentStartDateTime = currentStartDateTime;
                CurrentEndDateTime = currentEndDateTime;
                DataStartDateTime = dataStartDateTime;
                DataEndDateTime = dataEndDateTime;
            }  

            /// <summary>
            /// Create a new instance of the ResultsCriteria class with the values specified.
            /// </summary>
            /// <param name="clientGUID">The GUID of the Client used to retrieve the list</param>                
            /// <param name="branchGUID">The GUID of the Branch used to retrieve the list</param>     
            /// <param name="language">The language identifier (ie. en or fr) to use when localising text from the database.</param>   
            /// <param name="currentStartDateTime">The start date of the reporting period.</param>
            /// <param name="currentEndDateTime">The end date of the reporting period.</param>
            /// <param name="dataStartDateTime">The start date of when to retrieve data.</param>
            /// <param name="dataEndDateTime">The end date of when to retrieve data.</param>
            public ResultsCriteria(Guid clientGUID, Guid branchGUID, string language, DateTime currentStartDateTime, DateTime currentEndDateTime, DateTime dataStartDateTime, DateTime dataEndDateTime)
            {
                ClientGUID = clientGUID;
                BranchGUID = branchGUID;
                Language = language;
                CurrentStartDateTime = currentStartDateTime;
                CurrentEndDateTime = currentEndDateTime;
                DataStartDateTime = dataStartDateTime;
                DataEndDateTime = dataEndDateTime;
            }            

        #endregion

        #region Properties

            /// <summary>
            /// The ClientGUID associated with this criteria object.
            /// </summary>
            public static PropertyInfo<Guid> ClientGUIDProperty = RegisterProperty<Guid>(p => p.ClientGUID);
            public Guid ClientGUID
            {
                get { return ReadProperty(ClientGUIDProperty); }
                private set { LoadProperty(ClientGUIDProperty, value); }
            }

            /// <summary>
            /// The ProfileGUID associated with this criteria object.
            /// </summary>
            public static PropertyInfo<Guid> ProfileGUIDProperty = RegisterProperty<Guid>(p => p.ProfileGUID);
            public Guid ProfileGUID
            {
                get { return ReadProperty(ProfileGUIDProperty); }
                private set { LoadProperty(ProfileGUIDProperty, value); }
            }

            /// <summary>
            /// The ReportingLevel list associated with this criteria object.
            /// </summary>
            public static PropertyInfo<ReportingLevelInfoList> ReportingLevelsProperty = RegisterProperty<ReportingLevelInfoList>(p => p.ReportingLevels);
            public ReportingLevelInfoList ReportingLevels
            {
                get { return ReadProperty(ReportingLevelsProperty); }
                private set { LoadProperty(ReportingLevelsProperty, value); }
            }

            /// <summary>
            /// The BranchGUID associated with this criteria object.
            /// </summary>
            public static PropertyInfo<Nullable<Guid>> BranchGUIDProperty = RegisterProperty<Nullable<Guid>>(p => p.BranchGUID);
            public Nullable<Guid> BranchGUID
            {
                get { return ReadProperty(BranchGUIDProperty); }
                private set { LoadProperty(BranchGUIDProperty, value); }
            }

            /// <summary>
            /// This is the language identifier (ie. en or fr) to use when localising text from the database.
            /// </summary>
            public static PropertyInfo<string> LanguageProperty = RegisterProperty<string>(p => p.Language);
            public string Language
            {
                get { return ReadProperty(LanguageProperty); }
                private set { LoadProperty(LanguageProperty, value); }
            }

            /// <summary>
            /// The CurrentStartDateTime associated with this criteria object. This is the Current reporting period.
            /// </summary>
            public static PropertyInfo<DateTime> CurrentStartDateTimeProperty = RegisterProperty<DateTime>(p => p.CurrentStartDateTime);
            public DateTime CurrentStartDateTime
            {
                get { return ReadProperty(CurrentStartDateTimeProperty); }
                private set { LoadProperty(CurrentStartDateTimeProperty, value); }
            }

            /// <summary>
            /// The CurrentEndDateTime associated with this criteria object. This is the Current reporting period.
            /// </summary>
            public static PropertyInfo<DateTime> CurrentEndDateTimeProperty = RegisterProperty<DateTime>(p => p.CurrentEndDateTime);
            public DateTime CurrentEndDateTime
            {
                get { return ReadProperty(CurrentEndDateTimeProperty); }
                private set { LoadProperty(CurrentEndDateTimeProperty, value); }
            }

            /// <summary>
            /// The DataStartDateTime associated with this criteria object. This is the date range for retrieving actual data.
            /// </summary>
            public static PropertyInfo<DateTime> DataStartDateTimeProperty = RegisterProperty<DateTime>(p => p.DataStartDateTime);
            public DateTime DataStartDateTime
            {
                get { return ReadProperty(DataStartDateTimeProperty); }
                private set { LoadProperty(DataStartDateTimeProperty, value); }
            }

            /// <summary>
            /// The DataEndDateTime associated with this criteria object. This is the date range for retrieving actual data.
            /// </summary>
            public static PropertyInfo<DateTime> DataEndDateTimeProperty = RegisterProperty<DateTime>(p => p.DataEndDateTime);
            public DateTime DataEndDateTime
            {
                get { return ReadProperty(DataEndDateTimeProperty); }
                private set { LoadProperty(DataEndDateTimeProperty, value); }
            }

        #endregion             

    }
}
